package com.koron.standard.jobStock.overhaul.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.koron.standard.jobStock.overhaul.bean.po.OverhaulItemParams;
import com.koron.standard.jobStock.overhaul.mapper.OverhaulItemParamsMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 大修标准下工作项目-作业参数(OverhaulItemParams)表服务实现类
 *
 * @author jzp
 * @since 2021-09-16
 */
@Service
public class OverhaulItemParamsService extends ServiceImpl<OverhaulItemParamsMapper, OverhaulItemParams> {
    public void removeByOverhaulId(String overhaulId) {
        LambdaQueryWrapper<OverhaulItemParams> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(OverhaulItemParams::getOverhaulId, overhaulId);
        List<OverhaulItemParams> list = list(wrapper);
        removeByIds(list.stream().map(OverhaulItemParams::getId).collect(Collectors.toList()));
    }
}
